This repository contains code for the empirical application and simulation experiments in Leung (2019), "Treatment and Spillover Effects Under Network Interference." 

Dependencies: numpy, pandas, scipy, networkx, [snap](http://snap.stanford.edu).

Coded for Python 2.7.

The folder 'empirical\_application' contains code for the empirical application. These files produce Table 1 in the text.
The folder 'data' contains data for the empirical application. These are generated by 'construct\_dataset.py'. 
The folder 'sims' contains files for the simulation experiments. These files produce Tables 2 and 3 in the text.

Contents:
* monte\_carlo.py: simulate data, compute estimates and standard errors, output tables.
* functions.py: functions used in monte\_carlo.py and estimation.py.
* construct\_dataset.py: reshape data files of Cai et al. (2015) into a more convenient format.
* estimation.py: empirical application.

To run the simulations, execute monte\_carlo.py. The output is stored in a file 'results.txt' in the 'sims' folder. 

To run the empirical application, execute estimation.py. Output is placed in a file 'results.txt' in the 'empirical\_application' folder. To generate the files in the 'data' folder, first download the Cai et al. (2015) data from [AEAweb](https://www.aeaweb.org/articles?id=10.1257/app.20130442) and extract the contents directly to the cai\_data folder. Run the do file 'rawnet.do' from the extracted 'do' folder. Then run construct\_dataset.py.

